$(document).ready(function() {
	
	$('.viewresto').click(function(event){
		event.preventDefault();
		$(".overlayHolder").fadeToggle("fast");
		var intRestoID = $(this).attr('data-id');
		var Lat = $(this).attr('data-lat');
		var Lng = $(this).attr('data-lng');
		var getRestoThumb = $(this).attr('data-img');
		var getRestoAssets = $(this).attr('data-assets');
		var getRestoDescr = $(this).attr('data-description');
		var getDataTitle = $(this).attr('data-title');
		var getDate = $(this).attr('data-date');
		var getLo = $(this).attr('data-location');
			uri = 'dashboard/account_analysis_assets';

		        $.ajax({
        type: "POST",
        url: base_url+uri,
		data: {intRestoID:intRestoID},
        }).done(function(data) {
		overlayBox = '';
		overlayBox += '<div class="confirmationHolder">';
			overlayBox += '<div class="headerConfirm"><i class="icon-eye-open"></i> '+getDataTitle+' <div class="close doCancel" style="top:0;right:0;float:right;"><i class="icon-remove icon-white"></i></div></div>';
			overlayBox += '<div class="confirmationContent" >';
				overlayBox += '<div class="row">';
				overlayBox += '<div class="span7" >';
				overlayBox += '<div class="span2">';
				overlayBox += '<img style="margin-left:-15px;"src="'+base_url+'assets/uploaded/thumbnails/'+getRestoThumb+'" />';
			overlayBox += '</div>';
				overlayBox +='<h4 style="line-height:5%;">'+getDataTitle+'</h4>';
				overlayBox +='<p>'+getDate+'</p>';
				overlayBox +=getRestoDescr;
				// **** Screenshots map*****//
						overlayBox += '<div class="row">';
					overlayBox += '<div class="span3">';
					overlayBox +=data;
					
					overlayBox += '</div>';
					
					overlayBox += '<div class="span4">';
					overlayBox+= '<div class="mapContainer"><div id="map-canvas"></div></div>';
					
				overlayBox +='<b>'+getLo+'</b>';

					overlayBox += '</div>';

					overlayBox += '</div>';
										// ***** endof screenshot map***//

					overlayBox += '</div>';
				overlayBox += '</div>';
			overlayBox += '</div>';
			overlayBox += '</div>';

		$('.boxOverlayContent').html(overlayBox);
				$('.doCancel').click(function(){
			$(".overlayHolder").hide();
		});
					mapintialize(Lat,Lng);

		});



	});
	$('.closeOverlay').click(function(){
		$(this).css({
			'display':'none'
		});	
	});


});
	function mapintialize(Lat,Lng)
{

	var restoDetails ='';
	var restoLocation ='';
	var myLatLng = new google.maps.LatLng(Lat,Lng);
	var mapOptions = {
	  center: myLatLng,
	  zoom: 14,
      zoomControl: false,
	  panControl: false,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
	var contentString = '<div style="width:300px !important;" id="content">'+
						'<div id="siteNotice"></div>'+
						'<h4 id="firstHeading" class="firstHeading">'+restoDetails+'</h4>'+
						'<div id="bodyContent">'+
						'<p>'+restoLocation+'</p>'+
						'</div>'+
						'</div>';
	
	var infowindow = new google.maps.InfoWindow({
							content: contentString
					});
	var marker = new google.maps.Marker({
	  position: myLatLng,
	  map: map,
	  title: restoDetails,
	});
	google.maps.event.addListener(marker, 'click', function() {
		infowindow.open(map, marker);
	});
}
